package exercise1;

import java.util.Date;

public class SalariedEmployee extends Employee {
    private double monthlySalary;

    public SalariedEmployee(String name, long number, MyDate birthday) {
        super(name, number, birthday);
    }


    @Override
    public double earnings() {
        // 获取当前的月份
        Date date = new Date();
        int month = date.getMonth();
        // 月份和生日中的月份是否相等，如果相等，加100
        if (month == getBirthday().getMonth()){
            return monthlySalary + 100;
        }
        else {
            return monthlySalary;
        }

    }

    @Override
    public String toString() {
        return "SalariedEmployee{}";
    }
}
